import { instance } from "../utils/request";
const getDictionarysPagination = async (
  page: number,
  limit: number,
  key?: string
) => {
  return await instance.get("/Dictionarys/Pagination", { page, limit, key });
};

const addDictionarys = async (data: RequestCreateDictionarysDto) => {
  return await instance.post("/Dictionarys/Add", data);
};

const updateDictionarys = async (data: RequestUpdateDictionarysDto) => {
  return await instance.post("/Dictionarys/Update", data);
};

const getDictionarysDetail = async (id: number) => {
  return await instance.get("/Dictionarys/Detail", { id });
};

const deleteDictionarys = async (data: RequestIdDictionarysDto) => {
  return await instance.post("/Dictionarys/Delete", data);
};

const getDictionaryBySearchKey = async (searchKey: string) => {
  return await instance.get("/Dictionarys/GetDictionaryBySearchKey", {
    searchKey: searchKey,
  });
};

const DictionarysApi = {
  getDictionarysPagination,
  addDictionarys,
  updateDictionarys,
  getDictionarysDetail,
  deleteDictionarys,
  getDictionaryBySearchKey,
};

export default DictionarysApi;
